<template>
	<view class="">
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true" >
			<view class="" style="padding-top:20upx;">
				<view class="order-con" v-for="(item, index) in dataList" :key="index">
					<view class="order-top b-b row between">
						<view class="order-num">订单编号：{{item.orderNum}}</view>
						<view class="order-status" v-if="item.status==0"> 待发货</view>
						<view class="order-status" v-if="item.status==1"> 已发货</view>
						<view class="order-status" v-if="item.status==2"> 已完成</view>
					</view>
					<view class="order-item-info fill">
						<view class="row between" style="padding-bottom: 20upx;">
							<view class="cart-item-img">
								<image :src="item.icon" mode="aspectFill" class="img"></image>
							</view>
							<view class="cart-item-right fill">
								<view class="clamp2 cart-item-title">{{item.name}}</view>
								<view class="cart-item-price">积分:{{item.price}}</view>
							</view>
						</view>
						<view class="">
							<view >
								<text class="cart-item-use">收件人：{{item.addressName}}</text> <text class="cart-item-use">{{item.addressPhone}}</text>
							</view>
							<view class="cart-item-use">
								{{item.addressDetail}}
							</view>
						</view>
						<view class="order-bottom row between">
							<view class="cart-item-time">
								{{item.createDate}}
							</view>
							<view class="row">
								<view class="order-btn two" v-if="item.status==1" hover-class="hover-opacity" @tap.stop="confirmReceipt">确认收货</view>
								<!-- <view class="order-btn one" v-else hover-class="hover-opacity" @tap.stop="deleteOrder">删除订单</view> -->
							</view>
						</view>
					</view>
				</view>
			</view>
		</s-pull-scroll>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
import orderMixins from '@/common/mixin/order.js';
export default {
	mixins: [orderMixins],
	data() {
		return {
			dataList:[]
		}
	},
	onLoad() {
		this.refresh();
	},
	methods: {
		pullDown(pullScroll) {
			setTimeout(() => {
				this.loadData(pullScroll);
			}, 200);
		},
		async loadData(pullScroll) {
			const data = {
				uid:uni.getStorageSync('uid'),
				pageNo:pullScroll.page,
				pageSize:"10"
			};
			const res = await this.$request('integral/order-list', data, { showLoading: true });
			if (pullScroll.page == 1) this.dataList = [];
			if (res.result == 0) {
				this.dataList = this.dataList.concat(res.data.list);
				pullScroll.endByPage(Math.ceil(res.data.count / 10), res.data.list);
			} else {
				this.$util.msg(res.resultNote);
			}
		}
	}
};
</script>
<style>
page {
	background: #f6f6f6;
}
</style>

<style scoped lang="scss">
.order-con {
	background: #ffffff;
	border-radius: 20upx;
	width: 94%;
	margin: 0 auto;
	margin-bottom: 20upx;
	padding: 20upx;
}
.order-top {
	line-height: 70upx;
}
.order-num {
	font-size: 24upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #333333;
}
.order-status {
	font-size: 26upx;
	font-family: PingFang SC;
	font-weight: 500;
	color:#2781A7;
}
.order-item-info {
	padding-top: 20upx;
}
.cart-item-img {
	width: 144upx;
	height: 144upx;
	border-radius: 10upx;
	overflow: hidden;
	position: relative;
}
.img {
	width: 144upx;
	height: 144upx;
}
.cart-item-right {
	height: 144upx;
	position: relative;
	padding-left: 20upx;
}
.cart-item-title {
	font-size: 28upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #000000;
	line-height: 44upx;
	position: absolute;
	top: 0;
}
.cart-item-use{
	font-size: 24upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #666666;
	line-height: 36upx;
}
.cart-item-price {
	font-size:26upx;
	color:#FE2525;
	line-height: 36upx;
	position: absolute;
	bottom: 0;
}
.cart-item-time {
	font-size: 22upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #999999;
}
.order-bottom {
	padding-top: 20upx;
}
.order-btn {
	padding: 10upx 36upx;
	text-align: center;
	border-radius: 36upx;
	font-size: 26upx;
	font-family: PingFang SC;
	font-weight: 500;
}
.one {
	color: #666666;
	border: 1px solid #e7e7e7;
}
.two {
	color: #FE2525;
	border: 1px solid #FE2525;
}
</style>
